const fs = require('fs');
const path = require('path');

const routesDir = path.join(__dirname);
const files = fs.readdirSync(routesDir);
 const registerRoutes=(app)=>{
  files.forEach((file) => {
    if (file.endsWith('.js') && file!=='index.js') {
      // 导入路由模块
      const router = require(path.join(routesDir, file));
      // 注册路由模块
      app.use(router);
    }
  })
 }
 module.exports=registerRoutes

